import { defineStore } from 'pinia'
import { ref } from 'vue'

const useCounter = defineStore(
  'Counter',
  () => {
    const count = ref(0)
    const addCount = () => {
      count.value++
    }
    const cutCount = () => {
      count.value--
    }
    return { count, addCount, cutCount }
  },
  {
    unistorage: true, // 开启持久化
  }
)

export { useCounter }
